package com.yanqu.road.server.cmd.activity.channelmusicroomrank;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.MusicRoomRankProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.channelmusicroom.ChannelMusicRoomRankActivityModule;

import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_CHANNEL_MUSIC_ROOM_RANK_MAIN_SCENE, desc = "妙音坊冲榜 主界面")
public class ChannelMusicRoomRankMainSceneCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if (player.isRequestCmdTooFast(GameProtocol.S_CHANNEL_MUSIC_ROOM_RANK_MAIN_SCENE, 200)){
            return;
        }
        ret = player.getModule(ChannelMusicRoomRankActivityModule.class).getMainScene();
    }

    @Override
    public void sendData(GamePlayer player) {
        if (ret > 0) {
            player.sendPacket(ClientProtocol.U_CHANNEL_MUSIC_ROOM_RANK_MAIN_SCENE, MusicRoomRankProto.MusicRoomRankMainSceneRespMsg.newBuilder().setRet(ret));
        }
    }
}
